/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/**
 * \file
 * \brief bitOps utility example.
 * \author Antti Maula <antti.maula@tkk.fi>
 */
#include "../bitOps.h"
#include <stdio.h>
#include <inttypes.h>

int main(void)
{
  uint32_t a = 0xffffffff;
  uint32_t b = 0xa0a0a0a0;
  uint32_t c = a ^ b;
  uint64_t xa = 0xFFFFFFFFFFFFFFFF;
  uint64_t xb = 0xA0A0A0A0A0A0A0A0;
  uint64_t xc = xa ^ xb;

  printf("BitOps simple example. Just printing a few values in binary:\n\n");


  char buffer[256];
  printBits(buffer, a, 32);
  printf("0x%x\t\t==\t'%s'\n", a, buffer);

  printBits(buffer, b, 32);
  printf("0x%x\t\t==\t'%s'\n", b, buffer);

  printBits(buffer, c, 32);
  printf("0x%x\t\t==\t'%s'\n", c, buffer);

  printBits64(buffer, xa, 64);
  printf("0x%lx\t==\t'%s'\n", xa, buffer);
  printBits64(buffer, xb, 64);
  printf("0x%lx\t==\t'%s'\n", xb, buffer);
  printBits64(buffer, xc, 64);
  printf("0x%lx\t==\t'%s'\n", xc, buffer);


  printf("\nDone.\n\n");

  return 0;
}
